package com.yls.except.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class YiJiPayProperties {
	public static String getByType(String type) {
		String classpath = Thread.currentThread().getContextClassLoader()
				.getResource("/").getPath();
		String fileName = classpath + "yijipay.properties";
		Properties prop = new Properties();
		String param = null;
		try {
			FileInputStream in = new FileInputStream(fileName);
			prop.load(in);
			if ("paytenrid".equals(type)) //商户id
				param = prop.getProperty("PARTNER_ID").trim();
			else if("key".equals(type))  //安全秘钥
				param = prop.getProperty("SERCURITY_KEY").trim();
			else if("httppost".equals(type)) //请求方式
				param = prop.getProperty("HTTP_POST_PROTOCOL").trim();
			else if("signtype".equals(type))  //加密方式
				param = prop.getProperty("SIGN_TYPE").trim();
			else if("returnurl".equals(type)) //同步请求地址
				param = prop.getProperty("RETURN_URL").trim();
			else if("notifyurl".equals(type))  //异步请求地址
				param = prop.getProperty("NOTIFY_URL").trim();
			else if("refundservice".equals(type)) //退款service
				param = prop.getProperty("REFUNDSERIVCE").trim();
			else if("payservice".equals(type))  //支付service
				param = prop.getProperty("PAYSERIVCE").trim();
			else if("shopid".equals(type)) //卖家id
				param = prop.getProperty("SHOPID").trim();
			else if("shopname".equals(type)) //卖家名字
				param = prop.getProperty("SHOPNAME").trim();
			else if("GATEWA".equals(type)) //交易渠道（网关）
				param = prop.getProperty("GATEWAY").trim();
			else if("CASHIER_PC".equals(type)) //交易渠道（网关）
				param = prop.getProperty("CASHIER_PC").trim();
			else if("CASHIER_MOBILE".equals(type)) //交易渠道（网关）
				param = prop.getProperty("CASHIER_MOBILE").trim();
			else if("CASHIER_POS".equals(type)) //交易渠道（网关）
				param = prop.getProperty("CASHIER_POS").trim();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return param;
	}
}
